package com.study.hot.jetpack.room.one2many

import androidx.lifecycle.LiveData
import androidx.room.*

/**
 * <pre>
 *     author : fauks
 *     time   : 2020/03/25
 *     desc   :
 * </pre>
 */
@Dao
interface PersonDao {

    @Insert
    fun insert(vararg person: Person)

    // 此时Room会自动发出两条sql语句，使用事务保证原子性
    @Transaction
    @Query("SELECT * FROM Person")
    fun getPersonAndIdCard(): LiveData<List<PersonAndIdCard>>
}